package MtG.publicClass;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

/**
 * Card.java is a template class for creating different types of cards.
 * @author Marek Sirp
 * @author Jaan Sepp
 */
public abstract class Card implements Serializable {
	
	public Card(){
		controlCode = UUID.randomUUID();
	}
	
	private final String PATH = ".\\Images";
	/**
	 * Determines if a de-serialized file is compatible with this class.
	 */
	private static final long serialVersionUID = 3106514711590769042L;
	/**
	 * Field that holds the name of this card.
	 */
	private String cardName = "";
	/**
	 * Field that holds the description of this card.
	 */
	private String cardDescription = "";
	/**
	 * Field that holds the path to the image folder where all the card images are held.
	 */
	private String cardImage = "card_back.jpg";
	/**
	 * Field that holds the attack value of this card.
	 */
	private int attackValue = 0;
	/**
	 * Field that holds the defence value of this card.
	 */
	private int defenceValue = 0;
	/**
	 * boolean that determines if this card was used this turn or not.
	 */
	private boolean useThisTurn = false;
	/**
	 * integer that shows how much mana is needed to play this card.
	 */
	private int manaCost = 0;
	/**
	 * boolean that shows whether this card has been killed.
	 */
	private boolean dead = false;
	/**
	 * Determines if card is useable on this turn or not
	 */
	private boolean useable = false;
	
	private UUID controlCode;
	/**
	 * @param dead boolean value that will be set as the value of the 
	 * boolean that determines if this card is dead.
	 */
	public void setDead(boolean dead){
		this.dead = dead;
	}
	
	public UUID getControlCode() {
		return controlCode;
	}

	/**
	 * @return retrieve info on whether this card is dead or not.
	 */
	public boolean isDead(){
		return dead;
	}
	
	/**
	 * @param cost integer that will be set as this cards mana cost.
	 */
	public void setManaCost(int cost){
		this.manaCost = cost;
	}
	/**
	 * @return retrieve the amount that shows how much mana is needed in order to play this card.
	 */
	public int getManaCost(){
		return this.manaCost;
	}
	/**
	 * @param attack integer that will be set as this cards strength when attacking.
	 */
	public void setAttackValue(int attack){
		this.attackValue = attack;
	}
	/**
	 * @return retrieve the attack value of this card.
	 */
	public int getAttackValue(){
		return this.attackValue;
	}
	/**
	 * @param defence integer number that will be set as this cards defence strength.
	 */
	public void setDefenceValue(int defence){
		this.defenceValue = defence;
	}
	/**
	 * @return this cards defence strength as an integer.
	 */
	public int getDefenceValue(){
		return this.defenceValue;
	}
	/**
	 * @param card Name to be given to the card.
	 */
	public void setCardName(String card){
		this.cardName = card;
	}
	
	/**
	 * @return the name of this card.
	 */
	public String getCardName(){
		return this.cardName;
	}
	
	/**
	 * @param card extra information about this card.
	 */
	public void setCardDescription(String description){
		this.cardDescription = description;
	}
	
	/**
	 * @return the extra info about this card.
	 */
	public String getCardDescription(){
		return this.cardDescription;
	}
	
	/**
	 * @return the address of this cards image.
	 */
	public String getPicAddress(){
		return this.PATH + System.getProperty("file.separator") + this.cardImage;
	}
	/**
	 * @param path set the last part of the path to this cards image.
	 */
	public void setPicAddress(String path){
		this.cardImage = path;
	}
	
	/**
	 * @return retrieve the boolean that shows if this card was used this turn (to attack).
	 */
	public boolean isUseThisTurn(){
		return useThisTurn;
	}
	
	/**
	 * @param useThisTurn boolean value to be set to determine of this card has been used this turn.
	 */
	public void useOnthisturn(boolean useThisTurn){
		this.useThisTurn = useThisTurn;
	}
	
	/**
	 * getter for useable
	 * @return
	 */
	public boolean isUseable(){
		return useable;
	}
	
	/**
	 * setter for useable
	 * @param useable
	 */
	public void setUseable(Boolean useable){
		this.useable = useable;
	}
}
